#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int translate(std::string s) {
    if (s == "one") return 1;
    else if (s == "two") return 2;
    else if (s == "three") return 3;
    else if (s == "four") return 4;
    else if (s == "five") return 5;
    else if (s == "six") return 6;
    else if (s == "seven") return 7;
    else if (s == "eight") return 8;
    else if (s == "nine") return 9;
    else if (s == "zero") return 0;
    else return -1;
}

int create_num(std::vector<int> s) {
    int summ = 0;
    int exp = s.size() - 1;
    for (int i = 0; i < s.size(); i++) {
        summ += s[i] * pow(10, exp - i);
    }
    return summ;
}

bool is_simple_num(int a) {
    int k = 0;
    for (int i = 2; i <= a / 2; i++) {
        if (a % i == 0) {
            k++;
        }
    }
    return k <= 0;
}

int main() {
    std::string input;
    std::getline(std::cin, input);
    std::vector<std::string> s;
    std::string word = "";
    for (int i = 0; i < input.length(); i++) {
        if (input[i] == ' ') {
            s.push_back(word);
            word = "";
        } else {
            word += input[i];
        }
    }
    s.push_back(word);

    std::vector<int> sp;
    for (std::string x : s) {
        int num = translate(x);
        if (num >= 0) {
            sp.push_back(num);
        }
    }
    std::cout << "[";
    for (int i = 0; i < sp.size(); i++) {
        std::cout << sp[i];
        if (i != sp.size() - 1) {
            std::cout << ", ";
        }
    }
    std::cout << "]" << std::endl;

    if (s.size() != 3) {
        std::cout << "Wrong input" << std::endl;
    } else {
        int n = create_num(sp);
        std::cout << n << std::endl;
        for (int x = n; x >= 0; x--) {
            if (is_simple_num(x)) {
                std::cout << x << std::endl;
                break;
            }
        }
    }

    return 0;
}
